package com.rd.controller;


import com.rd.pojo.Department;
import com.rd.service.IDepartmentService;
import com.rd.util.ResultModel;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author qiufen
 * @since 2023-10-27
 */
@RestController
@RequestMapping("/hrm/dept")
public class DepartmentController {

    @Resource
    private IDepartmentService departmentService;

    @ApiOperation(value = "获取所有部门")
    @GetMapping("/deptList")
    public ResultModel getAllDepartments(){
        return departmentService.getAllDepartments();
    }

    @ApiOperation("添加部门")
    @PostMapping("/addDept")
    public ResultModel addDept(@RequestBody Department dep){
        return departmentService.addDept(dep);
    }

    @ApiOperation(value = "删除部门")
    @GetMapping("/deleteDept/{id}")
    public ResultModel deleteDep(@PathVariable Integer id){
        return departmentService.deleteDept(id);
    }

}
